package com.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA.
 * User:xieChao
 * Date:2022/11/29 23:01
 */
@Controller
public class UserController2 {

    private UserService userService;

    /**
     * 构造方法的注入
     * @param userService
     */
    //@Autowired
    public UserController2(UserService userService){
        this.userService = userService;
    }

    public void sayHi(){
       userService.sayHi();
        System.out.println("构造方法的注入");
    }

}
